IT TIP

가상 환경에서 Spyder를 실행하는 방법은 무엇입니까?

itqueen 2020. 10. 27. 23:55
반응형

가상 환경에서 Spyder를 실행하는 방법은 무엇입니까?


Python 2.7을 기본으로 사용하는 Anaconda 배포판과 함께 설치된 Spyder를 사용하고 있습니다. 현재 Python 3.4로 개발 가상 환경을 설정해야합니다.

온라인 조사 후 가장 좋은 두 가지 제안은 다음과 같습니다.

  1. 먼저 가상 환경을 설정하고 여기 에서 Spyder의 기본 설정을 변경합니다 .
  2. 예를 들어 가상 환경 자체에서, PyQt4 같은 모든 스파이더 종속성을 설치하려면 여기 ;

두 가지 권장 사항 모두 번거롭고 현명한 개발 옵션처럼 보이지 않습니다.

필요한 가상 환경을 활성화 한 후 필요한 Python 버전으로 Spyder를 자동으로 실행할 수있는 솔루션이 있습니까?


필요한 Python 버전으로 Anaconda에서 가상 환경생성 하는 옵션이 있습니다 .

conda create -n myenv python=3.4

활성화하려면 :

source activate myenv   # (in linux, you can use . as a shortcut for "source")
activate myenv          # (in windows - note that you should be in your c:\anaconda2 directory)

업데이트 . Ubuntu 18.04로 테스트했습니다. 이제이 명령을 사용하여 새 환경에 대해 추가로 spyder를 설치해야합니다 (위 명령으로 환경을 활성화 한 후).

conda install spyder

(또한 pip로 설치를 테스트했지만 Python 3.4 또는 이전 버전의 경우 수동 설치가 필요한 라이브러리 종속성 오류로 인해 중단됩니다.)

이제 Python 3.4로 Spyder를 실행하려면 다음을 입력하십시오.

spyder

Python 3.4를 사용한 스파이더


다음은 2019 년에이를 수행하는 빠른 방법입니다. Anaconda Navigator 사용 :

  1. Anaconda Navigator 열기
  2. 원하는대로 새로운 환경을 만드십시오. 이 환경을 "테스트"라고 명명했습니다. 활성화하려면 클릭하십시오.

여기에 이미지 설명 입력

  1. "홈"으로 이동하여 스파이더 상자에서 "설치"를 클릭합니다.

여기에 이미지 설명 입력

  1. Click "Launch/Run"

There are still some minor bugs when setting up your environment (most of which are solved by restarting the Navigator), if you find a bug, please post it in Anaconda Issues bug-tracker. Thanks.


If even then this doesn't work, Navigator could still be useful, clicking on >Enviroments takes you to a management window for the modules installed on such enviroment, searching and selecting the spyder related ones, and then clicking on Apply will install them and their dependencies.

여기에 이미지 설명 입력


Additional to tomaskazemekas's answer: you should install spyder in that virtual environment by:

conda install -n myenv spyder

(on Windows, for Linux or MacOS, you can search for similar commands)


What worked for me :

  1. run spyder from the environment (after source activate)
  2. go to Tools --> preferences --> python Interpreter and select the python file from the env you want to link to spyder ex : /home/you/anaconda3/envs/your_env/bin/python

Worked on ubuntu 16, spyder3, python3.6.


The above answers are correct but I calling spyder within my virtualenv would still use my PATH to look up the version of spyder in my default anaconda env. I found this answer which gave the following workaround:

source activate my_env            # activate your target env with spyder installed
conda info -e                     # look up the directory of your conda env
find /path/to/my/env -name spyder # search for the spyder executable in your env
/path/to/my/env/then/to/spyder    # run that executable directly

I chose this over modifying PATH or adding a link to the executable at a higher priority in PATH since I felt this was less likely to break other programs. However, I did add an alias to the executable in ~/.bash_aliases.


I just had the same problem trying to get Spyder to run in Virtual Environment.

The solution is simple:

가상 환경을 활성화하십시오.

그런 다음 가상 환경에 Spyder 및 해당 종속성 (PyQt5)을 설치합니다.

그런 다음 가상 환경 CLI에서 Spyder3를 시작합니다.

지금은 잘 작동합니다.

참고 URL : https://stackoverflow.com/questions/30170468/how-to-run-spyder-in-virtual-environment

반응형