简体   繁体   中英

Pycharm Virtulenv "non-zero exit code" after install wheel or module from pip

After installing kivy via a wheel i came upon an error in Pycharm when i refreshed my virtual env for python 3.4. The error is in the section

Pycharm: Projects -> Project Interpreter -> [Virtualenv packages]

Error/warning along the bottom shows "non-zero exit code"

My environment: Windows 8.1 64-bit Python 3.4.3 32-bit Pycharm 4.5.4 Virtual env - 3.4.3

This happened after i installed a wheel from " http://www.lfd.uci.edu/~gohlke/pythonlibs/ " (which is an awesome site... check it out) from the command line.

first i installed pygame from the downloaded wheel file located at" http://www.lfd.uci.edu/~gohlke/pythonlibs/ :

C:\Users\<user_name>\3.4Python_32Bit\Scripts> pip3.4.exe install C:\Users\<user_name>\Downloads\pygame-1.9.2a0-cp34-none-win32.whl

next i adjust the cython version:

C:\Users\<user_name>\3.4Python_32Bit\Scripts> pip3.4.exe install -I Cython==0.21.2

then i installed kivymd & kivy garden via the pycharm virtualenv interface within pycharm - both installed successfully.

Finally i tried to install "kivy"

The results were initially good, it showed installed, the package loaded in the virtualenv within pycharm, but when i reloaded the virtualenv in pycharm to associate it to a package the pycharm interface showed "non-zero exit code." How can this be fixed, there is no other errors visible?

The way this can be solved is by running the python from said environment

ie

C:\Users\<user_name>\3.4Python_32Bit\Scripts>python.exe C:\Users\<user_name>\3.4Python

_32Bit\\Lib\\site.py

The output will tell you what package you have that has failed when it gathers the packages from the "C:\\Users\\\\3.4Python_32Bit\\Lib\\site-packages":

Failed to import the site module
Traceback (most recent call last):
  File "C:\Users\<user_name>\3.4Python_32Bit\Lib\site.py", line 703, in <module>
    main()
  File "C:\Users\<user_name>\3.4Python_32Bit\Lib\site.py", line 683, in main
    paths_in_sys = addsitepackages(paths_in_sys)
  File "C:\Users\<user_name>\3.4Python_32Bit\Lib\site.py", line 282, in addsitepack
ages
    addsitedir(sitedir, known_paths)
  File "C:\Users\<user_name>\3.4Python_32Bit\Lib\site.py", line 204, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "C:\Users\<user_name>\3.4Python_32Bit\Lib\site.py", line 173, in addpackage
    exec(line)
  File "<string>", line 1, in <module>
KeyError: 'kivy'

In order to use your environment minus the package causing the issue is the remove the folder directly related to this error, in this case kivy:

remove C:\Users\<user_name>\3.4Python_32Bit\Lib\site-packages

If you want to reinstall the package confirm that you have the right dependencies, wheel(if this is what you are using), or you have the correct versions of installed packages. Then reinstall as needed.This can be applied to other packages with the same issues.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM